import numpy as np
arr1 = np.array([[10,20,30],[40,50,60]])
print('2x3的数组arr1:\n',arr1)
arr2 = np.array([[1,2,2],[2,2,3]])
print('2x3的数组arr2:\n',arr2)
print('arr1与arr2的加法运算：\n',arr1+arr2)
print('arr1与arr2的减法运算：\n',arr1-arr2)
print('arr1与arr2的乘法运算：\n',arr1*arr2)
print('arr1与arr2的除法运算：\n',arr1/arr2)
print('arr1与arr2的幂运算：\n',arr1**arr2)

import numpy as np
arr1 = np.array([[10,20,30],[40,20,60]])
arr2 = np.array([1,2,3])
print('arr1与arr2相加:\n',arr1+arr2)
arr3 = np.array([[1],[2]])
print('arr1与arr3相加：\n',arr1+arr3)
arr4 = np.array(5)
print('arr1与arr4相加：\n',arr1+arr4)

import numpy as np
arr = np.random.randint(1,100,size=(3,4))
print('3x4的原数组：\n',arr)
print('转置后4x3的数组:\n',arr.T)
print('变形后2x6的数组：\n',arr.reshape(2,6))



import numpy as np
arr1 = np.random.randint(1,10,size=(3,3))
print('随机生产的二维整数数组arr1:\n',arr1)
arr2 = np.random.randint(1,10,size=3)
print('随机生产的一维整数数组arr2:\n',arr2)
arr3 = np.random.rand(3,3)*10
print('随机生成的二维小数数组arr3:\n',arr3)
print('arr1和arr2相加：\n',np.add(arr1,arr2))
print('arr1和arr3相乘:\n',np.multiply(arr1,arr3))
print('以arr1为底数，arr2为指数的幂：\n',np.power(arr1,arr2,dtype='int64'))
print('arr1的倒数：\n',np.reciprocal(arr1,dtype='float'))
print('arr3四舍五入，小数点后保留一位：\n',np.around(arr3,decimals=1))
print('arr1的余弦值：\n',np.cos(arr1*np.pi/180))